package com.blockchain.console.servlets.trading.jjfq;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.blockchain.console.service.trading.TradingManage;
import com.blockchain.console.service.trading.entity.JyfqEntity;
import com.blockchain.console.servlets.trading.AbstractTradingServlet;
import com.blockchain.framework.http.servlet.annotation.Right;
import com.blockchain.framework.service.ServiceSession;
import com.blockchain.framework.service.query.Paging;
import com.blockchain.framework.service.query.PagingResult;
import com.blockchain.util.parser.IntegerParser;

@Right(id = "C_TRADING_JYFQLIST", isMenu = true, name = "交易分区")
public class JyfqList extends AbstractTradingServlet {

	private static final long serialVersionUID = 1L;

	@Override
	protected void processGet(HttpServletRequest request, HttpServletResponse response, ServiceSession serviceSession)
			throws Throwable {
		processPost(request, response, serviceSession);
	}

	@Override
	protected void processPost(final HttpServletRequest request, final HttpServletResponse response,
			final ServiceSession serviceSession) throws Throwable {
		TradingManage tsradingManage = serviceSession.getService(TradingManage.class);
		PagingResult<JyfqEntity> jyfqs = tsradingManage.jyfqSearch(new Paging() {

			@Override
			public int getSize() {
				return 10;
			}

			@Override
			public int getCurrentPage() {
				return IntegerParser.parse(request.getParameter(PAGING_CURRENT));
			}
		});
		request.setAttribute("jyfqs", jyfqs);
		forwardView(request, response, getClass());
	}

}
